<?php
@ini_set("display_errors","1");
@ini_set("display_startup_errors","1");

include("include/dbcommon.php");
header("Expires: Thu, 01 Jan 1970 00:00:01 GMT"); 

include("include/admin_rights_variables.php");


$gsqlHead="select `username` ";
$gsqlFrom="from `ppusers`";
$gsqlWhereExpr="";
$gsqlTail="";
// $gstrSQL = "SELECT TableName,   GroupID,   AccessMask  FROM sa_ugrights ";
$gstrSQL = gSQLWhere("");


if(!@$_SESSION["UserID"])
{ 
	$_SESSION["MyURL"]=$_SERVER["SCRIPT_NAME"]."?".$_SERVER["QUERY_STRING"];
	header("Location: login.php?message=expired"); 
	return;
}
if(!IsAdmin())
{
	echo "<p>".mlang_message("NO_PERMISSIONS")." <a href=\"login.php\">".mlang_message("BACK_TO_LOGIN")."</a></p>";
	return;
}



$layout = new TLayout("ug_rights","AnalisisAnalisis","MobileAnalisis");
$layout->blocks["center"] = array();
$layout->containers["ugcontrols"] = array();

$layout->containers["ugcontrols"][] = array("name"=>"ugbuttons","block"=>"savebuttons_block","substyle"=>1);


$layout->skins["ugcontrols"] = "1";
$layout->blocks["center"][] = "ugcontrols";
$layout->containers["message"] = array();

$layout->containers["message"][] = array("name"=>"message","block"=>"message_block","substyle"=>1);


$layout->skins["message"] = "1";
$layout->blocks["center"][] = "message";
$layout->containers["grid"] = array();

$layout->containers["grid"][] = array("name"=>"ugrightsblock","block"=>"rights_block","substyle"=>1);


$layout->skins["grid"] = "grid";
$layout->blocks["center"][] = "grid";
$layout->containers["pagination"] = array();

$layout->containers["pagination"][] = array("name"=>"pagination","block"=>"pagination_block","substyle"=>1);


$layout->skins["pagination"] = "2";
$layout->blocks["center"][] = "pagination";$layout->blocks["left"] = array();
$layout->containers["left"] = array();

$layout->containers["left"][] = array("name"=>"languages","block"=>"languages_block","substyle"=>1);


$layout->containers["left"][] = array("name"=>"loggedas","block"=>"security_block","substyle"=>1);


$layout->containers["left"][] = array("name"=>"vmenu","block"=>"menu_block","substyle"=>1);


$layout->skins["left"] = "menu";
$layout->blocks["left"][] = "left";
$layout->containers["uggroup"] = array();

$layout->containers["uggroup"][] = array("name"=>"ugrightsgroup","block"=>"","substyle"=>1);


$layout->skins["uggroup"] = "1";
$layout->blocks["left"][] = "uggroup";$layout->blocks["top"] = array();
$layout->skins["master"] = "empty";
$layout->blocks["top"][] = "master";
$layout->skins["toplinks"] = "2";
$layout->blocks["top"][] = "toplinks";
$layout->containers["search"] = array();


$layout->containers["search"][] = array("name"=>"details_found","block"=>"details_block","substyle"=>1);


$layout->containers["search"][] = array("name"=>"page_of","block"=>"pages_block","substyle"=>1);


$layout->containers["search"][] = array("name"=>"recsperpage","block"=>"recordspp_block","substyle"=>1);


$layout->skins["search"] = "2";
$layout->blocks["top"][] = "search";$page_layouts["admin_rights_list"] = $layout;


include('include/xtempl.php');
include('classes/runnerpage.php');
include('classes/listpage.php');
include('classes/rightspage.php');
$xt = new Xtempl();

$options = array();
//array of params for classes
$options["pageType"] = PAGE_LIST;
$options["id"] = postvalue("id") ? postvalue("id") : 1;
$options["mode"] = RIGHTS_PAGE;
$options['xt'] = &$xt;
$nonAdminTablesRightsArr=array();
$nonAdminTablesArr=array();
$pageRights=array();
$nonAdminTablesArr[] = array("ppmain",GetTableCaption("ppmain"));
$nonAdminTablesRightsArr["ppmain"]=array();
$pageRights["ppmain"]["add"]=false;
$pageRights["ppmain"]["edit"]=false;
$pageRights["ppmain"]["delete"]=false;
$pageRights["ppmain"]["list"]=true;
$pageRights["ppmain"]["export"]=true;
$pageRights["ppmain"]["import"]=false;

$nonAdminTablesArr[] = array("pppaypal_info",GetTableCaption("pppaypal_info"));
$nonAdminTablesRightsArr["pppaypal_info"]=array();
$pageRights["pppaypal_info"]["add"]=false;
$pageRights["pppaypal_info"]["edit"]=true;
$pageRights["pppaypal_info"]["delete"]=false;
$pageRights["pppaypal_info"]["list"]=true;
$pageRights["pppaypal_info"]["export"]=false;
$pageRights["pppaypal_info"]["import"]=false;

$nonAdminTablesArr[] = array("ppadmin main",GetTableCaption("ppadmin_main"));
$nonAdminTablesRightsArr["ppadmin main"]=array();
$pageRights["ppadmin main"]["add"]=true;
$pageRights["ppadmin main"]["edit"]=true;
$pageRights["ppadmin main"]["delete"]=true;
$pageRights["ppadmin main"]["list"]=true;
$pageRights["ppadmin main"]["export"]=true;
$pageRights["ppadmin main"]["import"]=false;

$nonAdminTablesArr[] = array("ppsubcategory",GetTableCaption("ppsubcategory"));
$nonAdminTablesRightsArr["ppsubcategory"]=array();
$pageRights["ppsubcategory"]["add"]=true;
$pageRights["ppsubcategory"]["edit"]=true;
$pageRights["ppsubcategory"]["delete"]=true;
$pageRights["ppsubcategory"]["list"]=true;
$pageRights["ppsubcategory"]["export"]=true;
$pageRights["ppsubcategory"]["import"]=false;

$nonAdminTablesArr[] = array("ppusers",GetTableCaption("ppusers"));
$nonAdminTablesRightsArr["ppusers"]=array();
$pageRights["ppusers"]["add"]=true;
$pageRights["ppusers"]["edit"]=true;
$pageRights["ppusers"]["delete"]=true;
$pageRights["ppusers"]["list"]=true;
$pageRights["ppusers"]["export"]=true;
$pageRights["ppusers"]["import"]=false;

$nonAdminTablesArr[] = array("ppcategory",GetTableCaption("ppcategory"));
$nonAdminTablesRightsArr["ppcategory"]=array();
$pageRights["ppcategory"]["add"]=true;
$pageRights["ppcategory"]["edit"]=true;
$pageRights["ppcategory"]["delete"]=true;
$pageRights["ppcategory"]["list"]=true;
$pageRights["ppcategory"]["export"]=true;
$pageRights["ppcategory"]["import"]=false;


$options["nonAdminTablesArr"] = $nonAdminTablesArr;
$options["nonAdminTablesRightsArr"] = $nonAdminTablesRightsArr;


$pageObject = ListPage::createListPage($strTableName, $options);
 // add button events if exist

// prepare code for build page
$pageObject->prepareForBuildPage();

// show page depends of mode
$pageObject->showPage();
	//$xt->assign_loopsection("grid_row",$rowinfo);
	


?>
